package cn.fl.mfr.web.controller;

import cmm.comm.facade.framework.api.ISysDictionaryApiService;
import cmm.comm.facade.framework.dto.SysDictionaryDTO;
import cmm.comm.facade.upload.api.IUploadApiService;
import cmm.comm.facade.upload.condition.SysUlDatCfgQueryCondition;
import cmm.comm.facade.upload.condition.SysUlFilesRecQueryCondition;
import cmm.comm.facade.upload.dto.SysUlDatCfgDTO;
import cmm.comm.facade.upload.dto.SysUlDatCfgDtlDTO;
import cmm.mid.core.framework.dto.DataResultDTO;
import cmm.mid.core.framework.page.DataResultVO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.mid.core.framework.page.ListPageVO;
import cmm.mid.core.framework.page.Pager;
import cmm.web.core.framework.controller.BaseController;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.constant.BaseExceptionConstant;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.logger.eum.LogExceptionEnum;
import cn.cmm.base.framework.logger.eum.LogOperEnum;
import cn.cmm.base.framework.utils.BaseLogUtils;
import cn.cmm.base.framework.utils.CollectionUtils;
import cn.cmm.base.framework.utils.DateUtils;
import cn.cmm.base.framework.utils.StringUtils;
import cn.cmm.cache.framework.utils.PropertiesCacheUtils;
import cn.fl.capital.constant.CapitalConstant;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.framework.constant.DictionaryConstant;
import cn.fl.mfr.web.service.IMfrInfoModService;
import cn.fl.mfr.web.service.IMfrRlPsnService;
import cn.fl.mfr.web.vo.MfrFlowSHVO;
import cn.fl.mfr.web.vo.MfrInfoModVO;
import cn.fl.mfr.web.vo.MfrRlPsnVO;
import cn.fl.product.service.IMfrInfoService;
import cn.fl.product.vo.MfrInfoVO;
import cn.fl.project.condition.PrjBscInfoQueryCondition;
import cn.fl.project.condition.PrjPrdBscInfoQueryCondition;
import cn.fl.project.service.IPrjBscInfoService;
import cn.fl.project.service.IPrjPrdBscInfoService;
import cn.fl.project.vo.PrjBscInfoVO;
import cn.fl.project.vo.PrjFileInfoVO;
import cn.fl.project.vo.PrjPrdBscInfoVO;
import cn.fl.system.constant.SysLogConstant;
import cn.fl.system.service.ISysDictionaryService;
import cn.fl.system.service.ISysUlFilesRecService;
import cn.fl.system.vo.SysUlFilesRecVO;
import cn.fl.upload.constant.UploadConstant;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import fl.constant.facade.framework.constant.BusinessIdConstant;
import fl.flow.facade.flow.api.IFlowApiService;
import fl.flow.facade.flow.condition.SysFlowSHQueryCondition;
import fl.flow.facade.flow.constant.FlowConstant;
import fl.flow.facade.flow.dto.SysFlowSHDTO;
import fl.spl.facade.framework.constant.SplSystemConstant;
import fl.spl.facade.framework.enums.SplInfoFileCfgEnum;
import fl.spl.facade.mfr.api.IMfrOrgRApiService;
import fl.spl.facade.mfr.condition.MfrInfoQueryCondition;
import fl.spl.facade.mfr.condition.MfrOrgRQC;
import fl.spl.facade.mfr.constant.MfrInfoConstant;
import fl.spl.facade.mfr.dto.MfrInfoDTO;
import fl.spl.facade.mfr.dto.MfrOrgRDTO;
import fl.spl.facade.spl.constant.SplInfoConstant;
import net.sf.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;

/**
 * @Description: 厂商信息表 控制层
 */
@Controller
@RequestMapping("/mfr/mfrBscInfo")
public class MfrBscInfoController extends BaseController {

    /**
     * PrdMfrInfo 服务层BEAN
     */
    @Autowired
    private IMfrInfoService mfrInfoService;

    /**
     * 项目产品基础信息表
     */
    @Autowired
    private IPrjPrdBscInfoService prjPrdBscInfoService;

    /**
     * 项目基础信息服务
     */
    @Autowired
    private IPrjBscInfoService prjBscInfoService;

    @Autowired
    private IMfrRlPsnService mfrRlPsnService;

    @Autowired
    private ISysDictionaryApiService sysDictionaryApiService;

    @Autowired
    private IMfrOrgRApiService mfrOrgRApiService;

    @Autowired
    private IMfrInfoModService mfrInfoModService;

    @Autowired
    private IUploadApiService uploadApiService;

    @Autowired
    private ISysUlFilesRecService sysUlFilesRecService;

    @Autowired
    private IFlowApiService flowApiService ;
    @Autowired
    private ISysDictionaryService sysDictionaryService ;

    /**
     * 到列表页面
     */
    @RequestMapping(value = "/toListPage.do", method = {RequestMethod.GET})
    public ModelAndView toListPage(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView view = new ModelAndView("mfr/mfrInfo/mfrInfoList");
        
        String currentOrgCd = CurrentThreadContext.getCurrentOrgCd();
        view.addObject("currentOrgCd", currentOrgCd);
        //事业部
  		List<KeyValueVO> searchBuOrgList = this.mfrInfoService.searchBuOrgCdList();
  		view.addObject("searchBuOrgList", searchBuOrgList);
        BaseLogUtils.newWebLogger("加载厂商列表页面").setLogOperType(LogOperEnum.REQ)
                .setSysCd(CurrentThreadContext.getCurrentSysCd())
                .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                .setWarning(false)
                .info();
        return view;
    }

    /**
     * 到详情列表页面
     */
    @RequestMapping(value = "/toDetailListPage.do", method = {RequestMethod.GET})
    public ModelAndView toDetailListPage(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView view = new ModelAndView("product/mfrInfo/prdMfrInfoDetailList");

        return view;
    }

    /**
     * 到详情页面
     */
    @RequestMapping(value = "/toDetailPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toDetailPage(HttpServletRequest request, HttpServletResponse response) {
        String id = request.getParameter("id");
        String audStsCd = request.getParameter("audStsCd");
        String isFlow = request.getParameter("isFlow"); //流程标识 1：是，0或者空：否
        String isCheckVerify = request.getParameter("isCheckVerify");//信审审核附件标识 1：是，0或者空：否
        String isDetail = request.getParameter("isDetail");//是否详细页面，流程中标识，1：是，0或者空：否
        String isMdfPayTyp = request.getParameter("isMdfPayTyp") ;//流程中是否可修改放款状态 1：是，0或者空：否
        String isModify = request.getParameter("isModify");//流程中是否可修改基本信息标识 1：是，0或者空：否
        //当前人组织架构代码,若当前人为系统管理员,则该CODE为管理员选择的组织结构代码
        String currentOrgCd = request.getParameter("currentOrgCd");
        String isMask = request.getParameter("isMask");

        BaseLogUtils.newWebLogger("加载厂商基本详情页面").setLogOperType(LogOperEnum.REQ)
                .setSysCd(CurrentThreadContext.getCurrentSysCd())
                .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                .setWarning(false)
                .info();
        ModelAndView view = null;
        if (StringUtils.isNotEmpty(isFlow) && BaseConstant.IS_YESNO_YES_STR.equals(isFlow)) {
            view = new ModelAndView("mfr/flow/mfrInfoFlowDetail");
        } else {
            view = new ModelAndView("mfr/mfrInfo/mfrInfoDetail");
        }
        if(StringUtils.isNotEmpty(isMask)){
        	view.addObject("isMask", isMask);
        }else{
        	view.addObject("isMask", "0");
        }
        view.addObject("id", id);
        view.addObject("audStsCd", audStsCd);
        view.addObject("isFlow", isFlow);
        view.addObject("isCheckVerify",isCheckVerify);
        view.addObject("isDetail",isDetail);
        view.addObject("isMdfPayTyp",isMdfPayTyp);
        view.addObject("isModify",isModify);
        view.addObject("currentOrgCd", currentOrgCd);

        return view;
    }

    /**
     * 到新增/修改页面
     */
    @RequestMapping(value = "/toAddPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toAddPage(HttpServletRequest request, HttpServletResponse response) {
        String id = request.getParameter("id");
        String isFlow = request.getParameter("isFlow"); //流程标识 1：是，0或者空：否
        String isMdfPayTyp = request.getParameter("isMdfPayTyp"); //是否可修改放款状态标识，1：是，0：否
        String isModify = request.getParameter("isModify"); //是否可修改基本信息，1：是，0：否

        String isCheckVerify = request.getParameter("isCheckVerify");//信审审核附件标识 1：是，0或者空：否
        String isDetail = request.getParameter("isDetail");//是否详细页面，流程中标识，1：是，0或者空：否
        //当前人组织架构代码,若当前人为系统管理员,则该CODE为管理员选择的组织结构代码
        String currentOrgCd = request.getParameter("currentOrgCd");

        BaseLogUtils.newWebLogger("加载厂商基本信息新增页面").setLogOperType(LogOperEnum.REQ)
                .setSysCd(CurrentThreadContext.getCurrentSysCd())
                .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                .setWarning(false)
                .info();
        ModelAndView view = null;
        if (StringUtils.isNotEmpty(isFlow) && BaseConstant.IS_YESNO_YES_STR.equals(isFlow)) {
            view = new ModelAndView("mfr/flow/mfrInfoFlowAdd");
        } else {
            view = new ModelAndView("mfr/mfrInfo/mfrInfoAdd");
        }
        view.addObject("id", id);
        view.addObject("payTypCdList", this.mfrInfoService.searchCdList("MFR0001"));
        // 证件类型
        List<KeyValueVO> certTypCdList = this.mfrRlPsnService.searchCertTypCdList();
        view.addObject("certTypCdListJSON", JSON.toJSON(certTypCdList));
        List<KeyValueVO> rlTypCDList = this.mfrRlPsnService.searchRlTypCdList();
        view.addObject("rlTypCDListJSON", JSON.toJSON(rlTypCDList));

        //流程相关页面控制 add by jiangzg 2019-1-14 09:27:55
        view.addObject("isFlow", isFlow); //是否流程中标识
        view.addObject("isMdfPayTyp", isMdfPayTyp); //是否可修改付款状态
        view.addObject("isModify", isModify); //是否可修改基本信息

        //必填联系人类型
        List<SysDictionaryDTO> mustAddRlPsnTypCds = this.sysDictionaryApiService.searchGroupAll(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_RL_TYP_CD);
        List<String> mustAddRlPsns = null;
        if (CollectionUtils.isNotEmpty(mustAddRlPsnTypCds)) {
            mustAddRlPsns = new ArrayList<>(mustAddRlPsnTypCds.size());
            for (SysDictionaryDTO dto : mustAddRlPsnTypCds) {
                if (BaseConstant.IS_YESNO_NO == dto.getIsSysDef()) {
                    continue;
                }
                mustAddRlPsns.add(dto.getCode());
            }
        }
        view.addObject("mustAddRlPsnTypCdJSON", null == mustAddRlPsns ? null : JSON.toJSON(mustAddRlPsns));

        //品牌
  		List<KeyValueVO> tkBrCdList = this.mfrInfoService.searchBrandList(DictionaryConstant.CODE_PRD_BR_CD_TK);
  		List<KeyValueVO> carBrCdList = this.mfrInfoService.searchBrandList(DictionaryConstant.CODE_PRD_BR_CD_CAR);
  		List<KeyValueVO> busBrCdList = this.mfrInfoService.searchBrandList(DictionaryConstant.CODE_PRD_BR_CD_BUS);

  		JSONArray tkBrCdListJSON = JSONArray.fromObject(tkBrCdList.toArray());
  		JSONArray carBrCdListJSON = JSONArray.fromObject(carBrCdList.toArray());
  		JSONArray busBrCdListJSON = JSONArray.fromObject(busBrCdList.toArray());
  		view.addObject("tkBrCdListJSON", tkBrCdListJSON);
  		view.addObject("carBrCdListJSON", carBrCdListJSON);
  		view.addObject("busBrCdListJSON", busBrCdListJSON);
        
        view.addObject("isCheckVerify",isCheckVerify);
        view.addObject("isDetail",isDetail);
        view.addObject("currentOrgCd", currentOrgCd);
        return view;
    }

    /**
     * 到变更流程审核页面
     */
    @RequestMapping(value = "/toModDetailPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toModDetailPage(HttpServletRequest request, HttpServletResponse response) {
        String modId = request.getParameter("modId");
        String isBsc = request.getParameter("isBsc");
        String isFlow= request.getParameter("isFlow");
        ModelAndView view = new ModelAndView("mfr/mfrInfoMod/mfrInfoDetail");
        Long mfrId = null;
        MfrInfoModVO mfrInfoModVO = this.mfrInfoModService.selectById(Long.valueOf(modId));
        if(mfrInfoModVO != null){
            if("0".equals(isBsc)){
                MfrOrgRDTO mfrOrgRDTO = this.mfrOrgRApiService.selectMfrOrgRDTOById(mfrInfoModVO.getMfrId(),CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(),"","");
                mfrId = mfrOrgRDTO.getMfrId();
            }else{
                mfrId = mfrInfoModVO.getMfrId();
            }
        }
        //业务类型 LIST
        List<String> busTypCdList = new ArrayList<>(2);
        busTypCdList.add(MfrInfoConstant.MFR_BASE_MOD_FLOW_BUS_TYP_CD);
        busTypCdList.add(MfrInfoConstant.MFR_PAY_TYP_MOD_FLOW_BUS_TYP_CD);

        SysFlowSHQueryCondition sysFlowSHQueryCondition = new SysFlowSHQueryCondition();
        sysFlowSHQueryCondition.setDataId(Long.valueOf(modId));
        sysFlowSHQueryCondition.setBusTypList(busTypCdList);
        sysFlowSHQueryCondition.setWordsInTheTable(MfrInfoConstant.MFR_INFO_FLOW_S_H_MFR);
        sysFlowSHQueryCondition.setStatus(BaseConstant.IS_YESNO_YES);
        sysFlowSHQueryCondition.setSysCd(SplSystemConstant.FL_SYS_CD);
        List<SysFlowSHDTO> sysFlowSHDTOs = this.flowApiService.searchFlowSHDTOList(sysFlowSHQueryCondition);
        if(CollectionUtils.isNotEmpty(sysFlowSHDTOs)){
            SysFlowSHDTO sysFlowSHDTO = sysFlowSHDTOs.get(0);
            view.addObject("currentOrgCd", sysFlowSHDTO.getOrgCd());
        }

        view.addObject("mfrId", mfrId);
        view.addObject("modId", modId);
        view.addObject("isBsc", isBsc);
        view.addObject("isFlow", isFlow);

        if(isBsc.equals("1")){
            //查询附件信息
            String cfgCd = null;
            String tabNm = null;
            String cfgOrgCd = null;
            String cfgSysCd = null;
            String modulePath = null;
            String rootPath = null;
            String costomerPath = null;
            String uploadSysCd = null;
            //自然人 附件查询
            cfgCd = SplInfoFileCfgEnum.MRF023.getCode();
            tabNm = SplInfoFileCfgEnum.MRF023.getTableNm();
            cfgOrgCd = SplInfoFileCfgEnum.MRF023.getOrgCd();
            cfgSysCd = SplInfoFileCfgEnum.MRF023.getSysCd();
            modulePath = SplInfoFileCfgEnum.MRF023.getModulePath();
            costomerPath = SplInfoFileCfgEnum.MRF023.getUploadCostomerPath();
            rootPath = SplInfoFileCfgEnum.MRF023.getUploadRootPath();
            uploadSysCd = SplInfoFileCfgEnum.MRF023.getUploadSysCd();

            view.addObject("tabNm", tabNm);
            view.addObject("cfgCd", cfgCd);
            view.addObject("cfgOrgCd", cfgOrgCd);
            view.addObject("cfgSysCd", cfgSysCd);
            view.addObject("modulePath", modulePath);
            view.addObject("costomerPath", costomerPath);
            view.addObject("rootPath", rootPath);
            view.addObject("uploadSysCd", uploadSysCd);

            String isApply = "1";
            String isCheckVerify = "1";//信审审核附件标识 1：是，0或者空：否
            String isDetail = "1";//是否详细页面，流程中标识，1：是，0或者空：否

            view.addObject("isDetail", isDetail);
            view.addObject("isApply", isApply);
            view.addObject("isCheckVerify", isCheckVerify);

        }
        BaseLogUtils.newWebLogger("加载厂商详情列表页面").setLogOperType(LogOperEnum.REQ)
                .setSysCd(CurrentThreadContext.getCurrentSysCd())
                .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                .setWarning(false)
                .info();
        return view;
    }

    /**
     * 到修改页面
     */
    @RequestMapping(value = "/toMfrModPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toMfrModPage(HttpServletRequest request, HttpServletResponse response) {
        String id = request.getParameter("id");
        String modId = request.getParameter("modId");
        String isFlow = request.getParameter("isFlow"); //流程标识 1：是，0或者空：否
        String isMdfPayTyp = request.getParameter("isMdfPayTyp"); //是否可修改放款状态标识，1：是，0：否
        String isModify = request.getParameter("isModify"); //是否可修改基本信息，1：是，0：否

        ModelAndView view = null;
        Long mfrId = null;
        if(StringUtils.isNotEmpty(id)){
            mfrId = Long.valueOf(id);
        }else{
            MfrInfoModVO mfrInfoModVO = this.mfrInfoModService.selectById(Long.valueOf(modId));
            if(mfrInfoModVO != null){
                if("0".equals(isModify)){
                    MfrOrgRDTO mfrOrgRDTO = this.mfrOrgRApiService.selectMfrOrgRDTOById(mfrInfoModVO.getMfrId(),CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(),"","");
                    mfrId = mfrOrgRDTO.getMfrId();
                }else{
                    mfrId = mfrInfoModVO.getMfrId();
                }
            }
        }
        String isApply = "1";
        String isCheckVerify = "0";//信审审核附件标识 1：是，0或者空：否
        String isDetail = "1";//是否详细页面，流程中标识，1：是，0或者空：否
        if (StringUtils.isNotEmpty(isModify) && BaseConstant.IS_YESNO_YES_STR.equals(isModify)) {
            view = new ModelAndView("mfr/mfrInfoMod/modifyMfrBscPage");
            //查询附件信息
            String cfgCd = null;
            String tabNm = null;
            String cfgOrgCd = null;
            String cfgSysCd = null;
            String modulePath = null;
            String rootPath = null;
            String costomerPath = null;
            String uploadSysCd = null;
            //自然人 附件查询
            cfgCd = SplInfoFileCfgEnum.MRF023.getCode();
            tabNm = SplInfoFileCfgEnum.MRF023.getTableNm();
            cfgOrgCd = SplInfoFileCfgEnum.MRF023.getOrgCd();
            cfgSysCd = SplInfoFileCfgEnum.MRF023.getSysCd();
            modulePath = SplInfoFileCfgEnum.MRF023.getModulePath();
            costomerPath = SplInfoFileCfgEnum.MRF023.getUploadCostomerPath();
            rootPath = SplInfoFileCfgEnum.MRF023.getUploadRootPath();
            uploadSysCd = SplInfoFileCfgEnum.MRF023.getUploadSysCd();

            view.addObject("tabNm", tabNm);
            view.addObject("cfgCd", cfgCd);
            view.addObject("cfgOrgCd", cfgOrgCd);
            view.addObject("cfgSysCd", cfgSysCd);
            view.addObject("modulePath", modulePath);
            view.addObject("costomerPath", costomerPath);
            view.addObject("rootPath", rootPath);
            view.addObject("uploadSysCd", uploadSysCd);

            String serverPath = PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_SERVER_PATH);// 服务地址
            String customerPah = PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_COSTOMER_PATH);
            String headPic = PropertiesCacheUtils.getProperty(fl.constant.facade.framework.constant.UploadConstant.DEFAULT_NO_PIC);
            view.addObject("defImg", serverPath + customerPah + headPic);
        } else {
            view = new ModelAndView("mfr/mfrInfoMod/modifyMfrPayTypPage");
        }
        view.addObject("mfrId", mfrId);
        view.addObject("modId", modId);
        view.addObject("payTypCdList", this.mfrInfoService.searchCdList("MFR0001"));
        // 证件类型
        List<KeyValueVO> certTypCdList = this.mfrRlPsnService.searchCertTypCdList();
        view.addObject("certTypCdListJSON", JSON.toJSON(certTypCdList));
        List<KeyValueVO> rlTypCDList = this.mfrRlPsnService.searchRlTypCdList();
        view.addObject("rlTypCDListJSON", JSON.toJSON(rlTypCDList));

        //流程相关页面控制 add by jiangzg 2019-1-14 09:27:55
        view.addObject("isFlow", isFlow); //是否流程中标识
        view.addObject("isMdfPayTyp", isMdfPayTyp); //是否可修改付款状态
        view.addObject("isModify", isModify); //是否可修改基本信息

        view.addObject("isDetail", isDetail);
        view.addObject("isApply", isApply);
        view.addObject("isCheckVerify", isCheckVerify);

        //必填联系人类型
        List<SysDictionaryDTO> mustAddRlPsnTypCds = this.sysDictionaryApiService.searchGroupAll(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_RL_TYP_CD);
        List<String> mustAddRlPsns = null;
        if (CollectionUtils.isNotEmpty(mustAddRlPsnTypCds)) {
            mustAddRlPsns = new ArrayList<>(mustAddRlPsnTypCds.size());
            for (SysDictionaryDTO dto : mustAddRlPsnTypCds) {
                if (BaseConstant.IS_YESNO_NO == dto.getIsSysDef()) {
                    continue;
                }
                mustAddRlPsns.add(dto.getCode());
            }
        }
        view.addObject("mustAddRlPsnTypCdJSON", null == mustAddRlPsns ? null : JSON.toJSON(mustAddRlPsns));
        //品牌
        List<KeyValueVO> tkBrCdList = this.mfrInfoService.searchBrandList(DictionaryConstant.CODE_PRD_BR_CD_TK);
        List<KeyValueVO> carBrCdList = this.mfrInfoService.searchBrandList(DictionaryConstant.CODE_PRD_BR_CD_CAR);
        List<KeyValueVO> busBrCdList = this.mfrInfoService.searchBrandList(DictionaryConstant.CODE_PRD_BR_CD_BUS);

        JSONArray tkBrCdListJSON = JSONArray.fromObject(tkBrCdList.toArray());
        JSONArray carBrCdListJSON = JSONArray.fromObject(carBrCdList.toArray());
        JSONArray busBrCdListJSON = JSONArray.fromObject(busBrCdList.toArray());
        view.addObject("tkBrCdListJSON", tkBrCdListJSON);
        view.addObject("carBrCdListJSON", carBrCdListJSON);
        view.addObject("busBrCdListJSON", busBrCdListJSON);
        view.addObject("currentOrgCd", CurrentThreadContext.getCurrentOrgCd());
        BaseLogUtils.newWebLogger("加载厂商基本信息新增页面").setLogOperType(LogOperEnum.REQ)
                .setSysCd(CurrentThreadContext.getCurrentSysCd())
                .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                .setWarning(false)
                .info();
        return view;
    }

    /**
     * 初始化列表
     */
    @SuppressWarnings("unchecked")
    @RequestMapping(value = "/initList.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object initMfrList(HttpServletRequest request, HttpServletResponse response) {
        String currentPage = request.getParameter("page");
        String pageSize = request.getParameter("pagesize");
        String mfrNm = request.getParameter("mfrNm");
        String mfrAddr = request.getParameter("mfrAddr");
        String sortName = request.getParameter("sortname");
        String sortOrder = request.getParameter("sortorder");
        String mfrIdsString = request.getParameter("mfrIdsString");

        String flag = request.getParameter("flag");//被引用为下拉框数据标识

        String condition = request.getParameter("condition");
        String value = "";
        if (StringUtils.isNotBlank(condition)) {
            String con = condition.substring(1, condition.length() - 1);
            if (StringUtils.isNotBlank(con)) {
                net.sf.json.JSONObject fromObject = net.sf.json.JSONObject.fromObject(con);
                value = (String) fromObject.get("value");
            }
        }

        Pager page = new Pager();
        if (StringUtils.isNotEmpty(currentPage)) {
            page.setCurrentPage(Integer.parseInt(currentPage));
        }

        if (StringUtils.isNotEmpty(currentPage)) {
            page.setEveryPage(Integer.parseInt(pageSize));
        }

        MfrInfoQueryCondition qc = new MfrInfoQueryCondition();
        if (StringUtils.isNotEmpty(mfrNm)) {
            qc.setMfrName(mfrNm);
        }
        if (StringUtils.isNotEmpty(mfrAddr)) {
            qc.setMfrAddr(mfrAddr);
        }
        if (StringUtils.isNotEmpty(sortName) && StringUtils.isNotEmpty(sortOrder)) {
            qc.setSortName(sortName);
            qc.setSortOrder(sortOrder);
        }
        if (StringUtils.isNotEmpty(flag)) {
            if (StringUtils.isEmpty(value) && StringUtils.isEmpty(mfrIdsString)) {//被引用为下拉框却没有查询条件返回null
                return null;
            }
            page.setEveryPage(Integer.MAX_VALUE);//最大数据量
            qc.setIsValid(BaseConstant.IS_YESNO_YES);//启用
            qc.setAudStsCd(FlowConstant.FLOW_CHECK_STATE_PASS);//审核通过
        }
        if (StringUtils.isNotEmpty(value)) {
            qc.setMfrName(value.trim());
        } else if (StringUtils.isNotEmpty(mfrIdsString)) {
            String[] strings = mfrIdsString.trim().split(";");
            List<Long> splIds = new ArrayList<Long>();
            for (String string : strings) {
                splIds.add(Long.valueOf(string));
            }
            qc.setIdList(splIds);
        }
        qc.setIsDel(BaseConstant.IS_YESNO_NO);
        page.setCondition(qc);
        Integer isMask = 1 ;
        String string = this.sysDictionaryService.getRoleisEncrypt();
        if(StringUtils.isNotEmpty(string)){
        	isMask = Integer.valueOf(string);
        }
        Pager pager = this.mfrInfoService.searchListPageByMask(page,isMask);
        List<MfrInfoDTO> list = (List<MfrInfoDTO>) pager.getResultList();
        ListPageVO<MfrInfoDTO> listPage = new ListPageVO<MfrInfoDTO>(list, pager.getTotalCount());
        BaseLogUtils.newWebLogger("初始化厂商列表页面数据结果").setLogOperType(LogOperEnum.RESP)
                .setSysCd(CurrentThreadContext.getCurrentSysCd())
                .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                .setWarning(false)
                .setKeys("listPage", JSON.toJSONString(listPage))
                .info();
        return listPage;
    }

    @RequestMapping("searchList.do")
    @ResponseBody
    public List<MfrInfoVO> searchList(String name) {

        MfrInfoQueryCondition qc = new MfrInfoQueryCondition();
        if (StringUtils.isNotBlank(name)) {
            qc.setMfrName(name);
        }
        List<MfrInfoVO> mfrInfoVOS = mfrInfoService.searchList(qc);
        return mfrInfoVOS;
    }

    /**
     * 删除数据
     */
    @RequestMapping(value = "/removeByIds.do", method = {RequestMethod.POST})
    @ResponseBody
    public DataResultVO removeMfrById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        String ids = request.getParameter("ids");
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
        if (StringUtils.isEmpty(ids)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
            BaseLogUtils.newWebLogger("删除厂商数据,主键参数为空").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .warn(LogExceptionEnum.COMMON_CODE_0002);
            return result;
        }

        List<Long> idsList = new ArrayList<Long>();
        JSONArray idsArray = JSONArray.fromObject(ids);
        for (Object object : idsArray) {
            idsList.add(Long.valueOf(object.toString()));
        }

        try {
            boolean success = this.mfrInfoService.removeByIds(idsList);
            if (!success) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(SysLogConstant.LOG_CMM_DELETE_FAIL);
                BaseLogUtils.newWebLogger("删除厂商失败").setLogOperType(LogOperEnum.RESP)
                        .setSysCd(CurrentThreadContext.getCurrentSysCd())
                        .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                        .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                        .setWarning(false)
                        .warn(LogExceptionEnum.COMMON_CODE_0002);
            }
            BaseLogUtils.newWebLogger("删除厂商数据成功").setLogOperType(LogOperEnum.RESP)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .info();
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.newWebLogger("删除厂商数据失败，业务异常").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .setThrowable(ex)
                    .warn(LogExceptionEnum.COMMON_CODE_0002);
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.newWebLogger("删除厂商数据失败，系统异常").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .setThrowable(ex)
                    .error(LogExceptionEnum.COMMON_CODE_0099);
        }

        return result;
    }

    /**
     * 得到一条记录
     *
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getById.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object getMfrById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        String id = request.getParameter("id");
        //当前人组织架构代码,若当前人为系统管理员,则该CODE为管理员选择的组织结构代码
        String currentOrgCd = request.getParameter("currentOrgCd");
        String isFlow = request.getParameter("isFlow");
        String isMaskStr = request.getParameter("isMask");
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
        if (StringUtils.isEmpty(id)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
            BaseLogUtils.newWebLogger("获取厂商数据,主键参数为空").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .warn(LogExceptionEnum.COMMON_CODE_0002);
            return result;
        }
        int isMask = 0 ;
        //根据角色查询是否需要掩码
        String roleisEncrypt = this.sysDictionaryService.getRoleisEncrypt();
        if(StringUtils.isNotEmpty(isMaskStr) && BaseConstant.IS_YESNO_YES_STR.equals(isMaskStr)
        		&& BaseConstant.IS_YESNO_YES_STR.equals(roleisEncrypt)){
        	isMask = 1 ;
        }
        try {
            List<SysFlowSHDTO> flowSHDTOList = null ;
            if(StringUtils.isNotEmpty(isFlow) && BaseConstant.IS_YESNO_YES_STR.equals(isFlow)){
                SysFlowSHQueryCondition sysFlowSHQueryCondition = new SysFlowSHQueryCondition();
                sysFlowSHQueryCondition.setSysCd(CurrentThreadContext.getCurrentSysCd());
                sysFlowSHQueryCondition.setDataId(Long.valueOf(id));
                sysFlowSHQueryCondition.setStatus(BaseConstant.IS_YESNO_YES);
                sysFlowSHQueryCondition.setWordsInTheTable(MfrInfoConstant.MFR_INFO_FLOW_S_H_MFR);
                flowSHDTOList = this.flowApiService.searchFlowSHDTOList(sysFlowSHQueryCondition);
                if(CollectionUtils.isNotEmpty(flowSHDTOList)){
                    SysFlowSHDTO sysFlowSHDTO = flowSHDTOList.get(0);
                    currentOrgCd = StringUtils.isEmpty(sysFlowSHDTO.getOrgCd()) ? sysFlowSHDTO.getBuOrgCd() : sysFlowSHDTO.getOrgCd() ;
                }
            }
            MfrInfoVO vo = this.mfrInfoService.selectByIdAndMask(Long.valueOf(id),isMask, currentOrgCd);
            if (null == vo) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(SysLogConstant.LOG_CMM_QUERY_DATA_IS_EMPTY);
                BaseLogUtils.newWebLogger("获取厂商数据不存在").setLogOperType(LogOperEnum.RESP)
                        .setSysCd(CurrentThreadContext.getCurrentSysCd())
                        .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                        .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                        .setWarning(false)
                        .warn(LogExceptionEnum.COMMON_CODE_0002);
            }
            result.setData(vo);
            BaseLogUtils.newWebLogger("获取厂商数据成功").setLogOperType(LogOperEnum.RESP)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .setKeys("result", JSON.toJSONString(result))
                    .info();
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.newWebLogger("获取厂商数据失败，业务异常").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .setThrowable(ex)
                    .warn(LogExceptionEnum.COMMON_CODE_0002);
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.newWebLogger("获取厂商数据失败，系统异常").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .setThrowable(ex)
                    .error(LogExceptionEnum.COMMON_CODE_0099);
            ex.printStackTrace();
        }
        return result;
    }

    /**
     * 新增
     */
    @RequestMapping(value = "/add.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object addMfr(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
        MfrInfoVO entity = new MfrInfoVO();
        try {
            entity = this.getRequestParamForPrdMfrAdd(request);//获取参数
            String currentOrgCd = request.getParameter("currentOrgCd");
            Long id = this.mfrInfoService.add(entity, currentOrgCd);
            result.setData(id);
            BaseLogUtils.newWebLogger("新增厂商数据成功").setLogOperType(LogOperEnum.RESP)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .setKeys("result", JSON.toJSONString(result))
                    .info();
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.newWebLogger("新增厂商数据失败，业务异常").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .setThrowable(ex)
                    .warn(LogExceptionEnum.COMMON_CODE_0002);
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.newWebLogger("新增厂商数据失败，系统异常").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .setThrowable(ex)
                    .error(LogExceptionEnum.COMMON_CODE_0099);
        }

        return result;
    }

    /**
     * 修改
     */
    @RequestMapping(value = "/modify.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object modifyMfr(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        String id = request.getParameter("id");
        String isFlow = request.getParameter("isFlow");
        String isModify = request.getParameter("isModify");
        String isMdfPayTyp = request.getParameter("isMdfPayTyp");
        String currentOrgCd = request.getParameter("currentOrgCd");
        
        if (StringUtils.isEmpty(currentOrgCd)) {
			currentOrgCd = CurrentThreadContext.getCurrentOrgCd();
		}

        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_UPDATE_SUCC);
        MfrInfoVO entity = new MfrInfoVO();
        if (StringUtils.isEmpty(id)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
            BaseLogUtils.newWebLogger("修改厂商信息,主键参数为空").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .warn(LogExceptionEnum.COMMON_CODE_0002);
            return result;
        }
        try {
            if((StringUtils.isNotEmpty(isFlow) && isFlow.equals(BaseConstant.IS_YESNO_YES_STR)) ||
                    (StringUtils.isNotEmpty(isModify) && isModify.equals(BaseConstant.IS_YESNO_YES_STR))
                    || (StringUtils.isNotEmpty(isMdfPayTyp) && BaseConstant.IS_YESNO_YES_STR.equals(isMdfPayTyp))){
                SysFlowSHQueryCondition sysFlowSHQueryCondition = new SysFlowSHQueryCondition();
                sysFlowSHQueryCondition.setWordsInTheTable(MfrInfoConstant.MFR_INFO_FLOW_S_H_MFR);
                sysFlowSHQueryCondition.setStatus(BaseConstant.IS_YESNO_YES);
                sysFlowSHQueryCondition.setDataId(Long.valueOf(id));
                sysFlowSHQueryCondition.setSysCd(CurrentThreadContext.getCurrentSysCd());
                List<SysFlowSHDTO> sysFlowSHDTOS = this.flowApiService.searchFlowSHDTOList(sysFlowSHQueryCondition);
                if(CollectionUtils.isNotEmpty(sysFlowSHDTOS)){
                    currentOrgCd = sysFlowSHDTOS.get(0).getOrgCd();
                }
            }
            if (StringUtils.isNotEmpty(isMdfPayTyp) && BaseConstant.IS_YESNO_YES_STR.equals(isMdfPayTyp)) {
                String payTypCd = request.getParameter("payTypCd");
                String payTypCdNm = request.getParameter("payTypCdNm");
                if (StringUtils.isEmpty(payTypCd)) {
                    BaseLogUtils.newWebLogger("修改厂商放款方式为空").setLogOperType(LogOperEnum.REQ)
                            .setSysCd(CurrentThreadContext.getCurrentSysCd())
                            .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                            .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                            .setWarning(false)
                            .warn(LogExceptionEnum.COMMON_CODE_0002);
                    result.setSuccess(BaseConstant.IS_YESNO_NO);
                    result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
                    result.setData(id);
                    return result;
                } else {
                    MfrOrgRQC mfrOrgRQC = new MfrOrgRQC();
                    if(currentOrgCd.length() > 8){
                        currentOrgCd = currentOrgCd.substring(0, 8);
                    }
                    mfrOrgRQC.setBuOrgCd(currentOrgCd);
                    mfrOrgRQC.setIsDel(BaseConstant.IS_YESNO_NO);
                    mfrOrgRQC.setIsValid(BaseConstant.IS_YESNO_YES);
                    mfrOrgRQC.setMfrId(Long.valueOf(id));
                    MfrOrgRDTO mfrOrgRDTO = new MfrOrgRDTO();
                    mfrOrgRDTO.setMfrLendCd(payTypCd);
                    mfrOrgRDTO.setMfrLendCdNm(payTypCdNm);
                    mfrOrgRDTO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
                    mfrOrgRDTO.setMdfTm(new Date());
                    DataResultDTO dataResultDTO = this.mfrOrgRApiService.updateMfrOrgRDTOByQC(mfrOrgRQC, mfrOrgRDTO);
                    BaseLogUtils.newWebLogger("修改厂商放款方式").setLogOperType(LogOperEnum.RESP)
                            .setSysCd(CurrentThreadContext.getCurrentSysCd())
                            .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                            .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                            .setWarning(false)
                            .setKeys("dataResultDTO", JSON.toJSONString(dataResultDTO))
                            .info();
                    if (null != dataResultDTO && dataResultDTO.getSuccess() == BaseConstant.IS_YESNO_YES) {
                        return result;
                    } else {
                        result.setSuccess(BaseConstant.IS_YESNO_NO);
                        result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
                        result.setData(id);
                        BaseLogUtils.newWebLogger("修改厂商放款方式失败").setLogOperType(LogOperEnum.RESP)
                                .setSysCd(CurrentThreadContext.getCurrentSysCd())
                                .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                                .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                                .setWarning(false)
                                .warn(LogExceptionEnum.COMMON_CODE_0002);
                        return result;
                    }
                }
            } else {
                entity = this.getRequestParamForPrdMfrModify(request);
                entity.setId(Long.valueOf(id));
            }
            boolean success = this.mfrInfoService.modify(entity, currentOrgCd);
            if (!success) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
                BaseLogUtils.newWebLogger("修改厂商数据失败").setLogOperType(LogOperEnum.RESP)
                        .setSysCd(CurrentThreadContext.getCurrentSysCd())
                        .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                        .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                        .setWarning(false)
                        .warn(LogExceptionEnum.COMMON_CODE_0002);
            }
            BaseLogUtils.newWebLogger("修改厂商数据成功").setLogOperType(LogOperEnum.RESP)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .setKeys("result", JSON.toJSONString(result))
                    .info();
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.newWebLogger("修改厂商数据失败，业务异常").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .setThrowable(ex)
                    .warn(LogExceptionEnum.COMMON_CODE_0002);
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.newWebLogger("修改厂商数据失败，系统异常").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .setThrowable(ex)
                    .error(LogExceptionEnum.COMMON_CODE_0099);
        }
        return result;
    }

    /**
     * 启用厂商
     */
    @RequestMapping(value = "/enable.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object enableMfr(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        String id = request.getParameter("id");
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ENABLE_SUCC);
        if (StringUtils.isEmpty(id)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
            BaseLogUtils.newWebLogger("启用厂商失败,主键参数为空").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .warn(LogExceptionEnum.COMMON_CODE_0002);
            return result;
        }

        try {

            boolean success = this.mfrInfoService.enAblePrdMfrInfo(Long.valueOf(id));
            if (!success) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(SysLogConstant.LOG_CMM_ENABLE_FAIL);
                BaseLogUtils.newWebLogger("启用厂商失败").setLogOperType(LogOperEnum.RESP)
                        .setSysCd(CurrentThreadContext.getCurrentSysCd())
                        .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                        .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                        .setWarning(false)
                        .warn(LogExceptionEnum.COMMON_CODE_0002);
            }
            BaseLogUtils.newWebLogger("启用厂商成功").setLogOperType(LogOperEnum.RESP)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .setKeys("result", JSON.toJSONString(result))
                    .info();
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.newWebLogger("启用厂商失败，业务异常").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .setThrowable(ex)
                    .warn(LogExceptionEnum.COMMON_CODE_0002);
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.newWebLogger("启用厂商失败，系统异常").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .setThrowable(ex)
                    .error(LogExceptionEnum.COMMON_CODE_0099);
        }
        return result;
    }

    /**
     * 禁用厂商
     */
    @RequestMapping(value = "/disable.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object disableMfr(HttpServletRequest request, HttpServletResponse response) throws BaseException {

        String id = request.getParameter("id");
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DISABLE_SUCC);
        if (StringUtils.isEmpty(id)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
            BaseLogUtils.newWebLogger("禁用厂商失败,主键参数为空").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .warn(LogExceptionEnum.COMMON_CODE_0002);
            return result;
        }

        try {

            boolean success = this.mfrInfoService.disAblePrdMfrInfo(Long.valueOf(id));
            if (!success) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(SysLogConstant.LOG_CMM_DISABLE_FAIL);
                BaseLogUtils.newWebLogger("禁用厂商失败").setLogOperType(LogOperEnum.RESP)
                        .setSysCd(CurrentThreadContext.getCurrentSysCd())
                        .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                        .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                        .setWarning(false)
                        .warn(LogExceptionEnum.COMMON_CODE_0002);
            }
            BaseLogUtils.newWebLogger("禁用厂商成功").setLogOperType(LogOperEnum.RESP)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .setKeys("result", JSON.toJSONString(result))
                    .info();
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.newWebLogger("禁用厂商失败，业务异常").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .setThrowable(ex)
                    .warn(LogExceptionEnum.COMMON_CODE_0002);
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.newWebLogger("禁用厂商失败，系统异常").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .setThrowable(ex)
                    .error(LogExceptionEnum.COMMON_CODE_0099);
        }
        return result;
    }

    /**
     * 跳转到厂商项目详细页面
     */
    @RequestMapping(value = "/toMfrPrjBscInfoDetailList.do", method = {RequestMethod.GET})
    public ModelAndView toMfrPrjBscInfoDetailList(HttpServletRequest request, HttpServletResponse response) {
        String mfrId = request.getParameter("mfrId");
        ModelAndView view = new ModelAndView("product/mfrInfo/mfrPrjBscInfoDetailList");
        view.addObject("mfrPrjViewFlag", "mfrPrjViewFlag");
        view.addObject("mfrId", mfrId);
        BaseLogUtils.newWebLogger("跳转到厂商项目详细列表").setLogOperType(LogOperEnum.REQ)
                .setSysCd(CurrentThreadContext.getCurrentSysCd())
                .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                .setWarning(false)
                .info();
        return view;
    }

    /**
     * 初始化列表
     */
    @SuppressWarnings("unchecked")
    @RequestMapping(value = "/initMfrPrjList.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object initMfrPrjList(HttpServletRequest request, HttpServletResponse response) {

        String mfrId = request.getParameter("mfrId");

        PrjPrdBscInfoQueryCondition qc = new PrjPrdBscInfoQueryCondition();
        qc.setSplMfrId(Long.parseLong(mfrId));
        // 获取该厂商下的所有项目产品
        List<PrjPrdBscInfoVO> prjPrdBscInfoVOList = prjPrdBscInfoService.searchList(qc);
        List<Long> ids = new ArrayList<>();
        for (PrjPrdBscInfoVO prjPrdBscInfoVO : prjPrdBscInfoVOList) {
            if (!ids.contains(prjPrdBscInfoVO.getPrjId())) {
                ids.add(prjPrdBscInfoVO.getPrjId());
            }
        }

        String currentPage = request.getParameter("page");
        String pageSize = request.getParameter("pagesize");
        String prjNm = request.getParameter("prjNm");
        String cstNm = request.getParameter("cstNm");
        String prjTyCd = request.getParameter("prjTypCd");
        String bizTypCd = request.getParameter("bizTypCd");
        String prjStsCd = request.getParameter("prjStsCd");
        String buOrgCd = request.getParameter("buOrgCd");// 事业部
        String cstId = request.getParameter("cstId");// 客户ID
        String splId = request.getParameter("splId");// 供应商ID(YAOXIURONG)
        String lsCntNo = request.getParameter("lsCntNo");
        String lnkCompId = request.getParameter("lnkCompId");// 挂靠公司ID
        String cstMgrNm = request.getParameter("cstMgrNm");// 客户经理
        String cntTypCd = request.getParameter("cntTypCd");
        String isDel = request.getParameter("isDel");//是否删除
        String cstMgrOrgCd = request.getParameter("cstMgrOrgCd");
        String userNm = request.getParameter("userNm");
        String ovdViewFlag = request.getParameter("ovdViewFlag");
        String cstMgrId = request.getParameter("cstMgrId");
        String insCode = request.getParameter("insCode");
        String fundRasInsId = request.getParameter("fundRasInsId");
        String stDt = request.getParameter("stDt");
        String endDt = request.getParameter("endDt");
        Pager page = new Pager();

        if (StringUtils.isNotEmpty(currentPage)) {
            page.setCurrentPage(Integer.parseInt(currentPage));
        }
        if (StringUtils.isNotEmpty(currentPage)) {
            page.setEveryPage(Integer.parseInt(pageSize));
        }

        PrjBscInfoQueryCondition prjBscInfoQueryCondition = new PrjBscInfoQueryCondition();
        if (CollectionUtils.isNotEmpty(ids)) {
            prjBscInfoQueryCondition.setIdList(ids);
        }
        if (StringUtils.isNotBlank(stDt)) {
            prjBscInfoQueryCondition.setStDt(DateUtils.formatStringToDate(stDt, DateUtils.YYYY_MM_DD));
        }
        if (StringUtils.isNotBlank(endDt)) {
            prjBscInfoQueryCondition.setEndDt(DateUtils.formatStringToDate(endDt, DateUtils.YYYY_MM_DD));
        }
        if (StringUtils.isNotBlank(fundRasInsId)) {
            prjBscInfoQueryCondition.setFundRasInsId(Long.valueOf(fundRasInsId));
        }
        if (StringUtils.isNotBlank(insCode)) {
            prjBscInfoQueryCondition.setInsCode(insCode);
        }
        if (StringUtils.isNotBlank(cstMgrOrgCd)) {
            prjBscInfoQueryCondition.setCstMgrOrgCd(cstMgrOrgCd);
        }
        if (StringUtils.isNotBlank(buOrgCd)) {
            prjBscInfoQueryCondition.setBuOrgCd(buOrgCd);
        }
        if (StringUtils.isNotBlank(isDel)) {
            prjBscInfoQueryCondition.setIsDel(Integer.valueOf(isDel));
        }
        if (StringUtils.isNotBlank(lsCntNo)) {
            prjBscInfoQueryCondition.setLsCntNo(lsCntNo);
        }
        if (StringUtils.isNotBlank(cntTypCd)) {
            prjBscInfoQueryCondition.setCntTypCd(cntTypCd);
        }
        if (StringUtils.isNotBlank(cstMgrNm)) {
            prjBscInfoQueryCondition.setCstMgrNm(cstMgrNm);
        }
        if (StringUtils.isNotBlank(lnkCompId)) {
            prjBscInfoQueryCondition.setCompLnkId(Long.valueOf(lnkCompId));
        }
        if (StringUtils.isNotBlank(prjNm)) {
            prjBscInfoQueryCondition.setPrjNm(prjNm);
        }
        if (StringUtils.isNotBlank(cstNm)) {
            prjBscInfoQueryCondition.setCstNm(cstNm);
        }
        if (StringUtils.isNotBlank(prjTyCd)) {
            prjBscInfoQueryCondition.setPrjTypCd(prjTyCd);
        }
        if (StringUtils.isNotBlank(bizTypCd)) {
            prjBscInfoQueryCondition.setBizTypCd(bizTypCd);
        }
        if (StringUtils.isNotBlank(prjStsCd)) {
            if (prjStsCd.equals(FlowConstant.FLOW_CHECK_STATE_NON)) {
                prjBscInfoQueryCondition.setDefPrjStsCd(prjStsCd);
            } else {
                prjBscInfoQueryCondition.setPrjStsCd(prjStsCd);
            }
            prjBscInfoQueryCondition.setSysCd(CurrentThreadContext.getCurrentSysCd());
        }
        if (StringUtils.isNotEmpty(cstId) && StringUtils.isNumeric(cstId)) {
            List<Long> cstIdList = new ArrayList<>();
            cstIdList.add(Long.valueOf(cstId));
            prjBscInfoQueryCondition.setCstIdList(cstIdList);
        }
        if (StringUtils.isNotEmpty(splId) && StringUtils.isNumeric(splId)) {
            prjBscInfoQueryCondition.setSplId(Long.valueOf(splId));// YAOXIURONG
        }
        if (StringUtils.isNotEmpty(mfrId) && StringUtils.isNumeric(mfrId)) {
            prjBscInfoQueryCondition.setMfrId(Long.valueOf(mfrId));// tsn
        }
        if (StringUtils.isNotEmpty(userNm)) {
            prjBscInfoQueryCondition.setUserNm(userNm);
        }
        prjBscInfoQueryCondition.setUsrId(CurrentThreadContext.getCurrentUserId());
        prjBscInfoQueryCondition.setSysCd(CurrentThreadContext.getCurrentSysCd());
        if (StringUtils.isNotEmpty(cstMgrId)) {
            prjBscInfoQueryCondition.setCstMgrId(Long.parseLong(cstMgrId));
        }
        page.setCondition(prjBscInfoQueryCondition);
        Pager pager = this.prjBscInfoService.searchListPage(page);
        List<PrjBscInfoVO> list = (List<PrjBscInfoVO>) pager.getResultList();
        if (CollectionUtils.isNotEmpty(list) && "ovdViewFlag".equals(ovdViewFlag)) {
            this.prjBscInfoService.putOvdDataToPrjBscInfo(list);
        }
        ListPageVO<PrjBscInfoVO> listPage = new ListPageVO<PrjBscInfoVO>(list,
                pager.getTotalCount());
        return listPage;

    }

    /**
     * 跳转到厂商项目详细页面
     */
    @RequestMapping(value = "/checkMfr.do", method = {RequestMethod.GET})
    @ResponseBody
    public DataResultVO checkMfr(HttpServletRequest request, HttpServletResponse response) {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES);

        String mfrId = request.getParameter("mfrId");
        String mfrNm = request.getParameter("mfrNm");
        String succ = request.getParameter("succ");
        String currentOrgCd = request.getParameter("currentOrgCd");

        if (StringUtils.isEmpty(mfrNm)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("厂商名称不能为空");
            BaseLogUtils.newWebLogger("厂商名称不能为空").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .warn(LogExceptionEnum.COMMON_CODE_0002);
        }

        // 特殊字符(除中英文括号外)和空格校验
        String checkMfrNm = checkMfrNm(mfrNm);

        // 校验前后的名称不一致,提示用户是否修改名称
        if (!checkMfrNm.equals(mfrNm)) {
            result.setSuccess(2);
            result.setInfo("厂商名称不允许包含特殊字符,是否替换为:" + checkMfrNm);
            result.setData(checkMfrNm);
            return result;
        }

        MfrInfoQueryCondition condition = new MfrInfoQueryCondition();
        condition.setMfrName(checkMfrNm);
        condition.setIsDel(BaseConstant.IS_YESNO_NO);
        List<MfrInfoVO> searchList = this.mfrInfoService.searchList(condition);
        if (CollectionUtils.isNotEmpty(searchList)) {
        	MfrInfoVO mfrInfoVO = searchList.get(0);
        	if (StringUtils.isNotEmpty(mfrId) && searchList.size() == 1) {
				if (mfrId.equals(mfrInfoVO.getId() + "")) {
					result.setSuccess(1);
		            return result;
				}
			}
            result.setSuccess(0);
            result.setInfo("公司名称已存在，请勿重复添加!");
            result.setData(mfrInfoVO.getId());
            return result;
        } else {
            result.setSuccess(1);
        }
        
        condition = new MfrInfoQueryCondition();
        condition.setSucc(succ);
        condition.setIsDel(BaseConstant.IS_YESNO_NO);
        searchList = this.mfrInfoService.searchList(condition);
        if (CollectionUtils.isNotEmpty(searchList)) {
        	MfrInfoVO mfrInfoVO = searchList.get(0);
        	if (StringUtils.isNotEmpty(mfrId) && searchList.size() == 1) {
				if (mfrId.equals(mfrInfoVO.getId() + "")) {
					result.setSuccess(1);
		            return result;
				}
			}
            result.setSuccess(0);
            result.setInfo("统一社会信用代码已存在，请勿重复添加!");
            result.setData(searchList.get(0).getId());
            return result;
        } else {
            result.setSuccess(1);
        }

        BaseLogUtils.newWebLogger("请求结束").setLogOperType(LogOperEnum.RESP)
                .setSysCd(CurrentThreadContext.getCurrentSysCd())
                .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                .setWarning(false)
                .setKeys("result", JSON.toJSONString(result))
                .info();
        return result;
    }


    //********************私有方法********************//

    /**
     * 获取厂商参数信息
     *
     * @param request
     * @return
     * @throws BaseException
     */
    private MfrInfoVO getRequestParamForPrdMfr(HttpServletRequest request) throws BaseException {
        String mfrNm = request.getParameter("mfrNm");//厂商名称
        String succ = request.getParameter("succ");// 社会统一信用代码
        String mfrAddrese = request.getParameter("mfrAddr");// 厂商地址
        String rgnPrCd = request.getParameter("rgnPrCd");
        String rgnCyCd = request.getParameter("rgnCyCd");
        String mfrTel = request.getParameter("mfrTel");//办公电话
        String tkBrCdString = request.getParameter("tkBrCd");
        String carBrCdString = request.getParameter("carBrCd");
        String busBrCdString = request.getParameter("busBrCd");
        String payTypCd = request.getParameter("payTypCd");//放款方式 0.非差额放款 1.差额放款 默认0
        String payTypCdNm = request.getParameter("payTypCdNm");//放款方式 0.非差额放款 1.差额放款 默认0
        String mfrRlPsnListString = request.getParameter("mfrRlPsnList");// 主要人员名称

        List<MfrRlPsnVO> mfrRlPsnList = null;

        //验证必填项及长度
        if (StringUtils.isBlank(mfrNm)) {
            throw new BaseException(BaseExceptionConstant.COMMON_0001, "厂商名称不能为空.");
        }
        if (StringUtils.isEmpty(succ)) {
            throw new BaseException(BaseExceptionConstant.COMMON_0001, "社会统一信用代码不能为空");
        }
        /*if (StringUtils.isBlank(mfrRlPsnListString) || !StringUtils.isCustomerName(lmNm)) {
            throw new BaseException(BaseExceptionConstant.COMMON_0001, "联系人不能为空,支持格式[艾合买提•倪格提]");
        }*/
        if (StringUtils.isNotBlank(mfrTel)) {
            if (!StringUtils.isMobilePhoneAndFixedPhone(mfrTel)) {
                throw new BaseException(BaseExceptionConstant.COMMON_0001, "请输入正确的办公电话.");
            }
        }
        if (StringUtils.isEmpty(mfrRlPsnListString)) {
            throw new BaseException(BaseExceptionConstant.COMMON_0001, "请维护主要人员关系");
        } else {
            mfrRlPsnList = JSONObject.parseArray(mfrRlPsnListString, MfrRlPsnVO.class);

            //证件类型
            Map<String, String> rlTypCdList = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(),
                    CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_RL_TYP_CD);

            boolean isHaveActualPsn1 = false; //法人代表
            boolean isHaveActualPsn3 = false; //联系人
            boolean isHaveActualPsn4 = false;    //实际控制人
            boolean isHaveActualPsn5 = false;    //股东

            //证件类型

            for (MfrRlPsnVO mfrRlPsnVO : mfrRlPsnList) {
                //验证输入项是否为空
                if (StringUtils.isEmpty(mfrRlPsnVO.getRlNm()) || !StringUtils.isCustomerName(mfrRlPsnVO.getRlNm())) {
                    throw new BaseException(BaseExceptionConstant.COMMON_0001, rlTypCdList.get(mfrRlPsnVO.getRlTypCd()) + "姓名为空或格式不正确,支持格式[艾合买提•倪格提]");
                } else if (StringUtils.isEmpty(mfrRlPsnVO.getRlTypCd())) {
                    throw new BaseException(BaseExceptionConstant.COMMON_0001, "联系人类型不能为空.");
                }
                if ("1".equals(mfrRlPsnVO.getIsDefault() + "") && (SplInfoConstant.SPL_RL_TYP_CD_ACTUAL_1.equals(mfrRlPsnVO.getRlTypCd())
                        || SplInfoConstant.SPL_RL_TYP_CD_ACTUAL_5.equals(mfrRlPsnVO.getRlTypCd())
                        || SplInfoConstant.SPL_RL_TYP_CD_ACTUAL_3.equals(mfrRlPsnVO.getRlTypCd())
                        || SplInfoConstant.SPL_RL_TYP_CD_ACTUAL_4.equals(mfrRlPsnVO.getRlTypCd()))) {

                    //验证输入项是否为空
                    if (StringUtils.isEmpty(mfrRlPsnVO.getTel())) {
                        throw new BaseException(BaseExceptionConstant.COMMON_0001, rlTypCdList.get(mfrRlPsnVO.getRlTypCd()) + "电话不能为空.");
                    } else if (StringUtils.isEmpty(mfrRlPsnVO.getCertTypCd())) {
                        throw new BaseException(BaseExceptionConstant.COMMON_0001, rlTypCdList.get(mfrRlPsnVO.getRlTypCd()) + "证件类型不能为空.");
                    } else if (StringUtils.isEmpty(mfrRlPsnVO.getCertNo())) {
                        throw new BaseException(BaseExceptionConstant.COMMON_0001, rlTypCdList.get(mfrRlPsnVO.getRlTypCd()) + "证件号码不能为空.");
                    }
                }

                if (null != mfrRlPsnVO && SplInfoConstant.SPL_RL_TYP_CD_ACTUAL_1.equals(mfrRlPsnVO.getRlTypCd())) {
                    isHaveActualPsn1 = true;
                } else if (null != mfrRlPsnVO && SplInfoConstant.SPL_RL_TYP_CD_ACTUAL_3.equals(mfrRlPsnVO.getRlTypCd())) {
                    isHaveActualPsn3 = true;
                } else if (null != mfrRlPsnVO && SplInfoConstant.SPL_RL_TYP_CD_ACTUAL_4.equals(mfrRlPsnVO.getRlTypCd())) {
                    isHaveActualPsn4 = true;
                } else if (null != mfrRlPsnVO && SplInfoConstant.SPL_RL_TYP_CD_ACTUAL_5.equals(mfrRlPsnVO.getRlTypCd())) {
                    isHaveActualPsn5 = true;
                }
            }
            if (!isHaveActualPsn1) {
                throw new BaseException(BaseExceptionConstant.COMMON_0001, "请维护法人代表.");
            }
            if (!isHaveActualPsn3) {
                throw new BaseException(BaseExceptionConstant.COMMON_0001, "请维护主要联系人.");
            }
            if (!isHaveActualPsn4) {
                throw new BaseException(BaseExceptionConstant.COMMON_0001, "请维护实际控制人.");
            }
            if (!isHaveActualPsn5) {
                throw new BaseException(BaseExceptionConstant.COMMON_0001, "请维护股东信息.");
            }

            if (CollectionUtils.isNotEmpty(mfrRlPsnList)) {
                for (MfrRlPsnVO mfrRlPsnVO : mfrRlPsnList) {
                    if (StringUtils.isEmpty(mfrRlPsnVO.getIsDel())) {
                        mfrRlPsnVO.setIsDel(BaseConstant.IS_YESNO_NO);
                        mfrRlPsnVO.setIsValid(BaseConstant.IS_YESNO_YES);
                    }
                    if (StringUtils.isEmpty(mfrRlPsnVO.getId())) {
                        mfrRlPsnVO.setIsDel(BaseConstant.IS_YESNO_NO);
                        mfrRlPsnVO.setIsValid(BaseConstant.IS_YESNO_YES);
                        mfrRlPsnVO.setCrtTm(new Date());
                        mfrRlPsnVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
                    } else {
                        mfrRlPsnVO.setMdfTm(new Date());
                        mfrRlPsnVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
                    }
                    mfrRlPsnVO.setBrPerVerify("2");
                    mfrRlPsnVO.setPyPerVerify("2");
                    mfrRlPsnVO.setTdPerVerify("2");
                    mfrRlPsnVO.setBusInfoVerify("2");
                }
            }
            BaseLogUtils.newWebLogger("联系人信息").setLogOperType(LogOperEnum.RESP)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .setKeys("mfrRlPsnList", JSON.toJSONString(mfrRlPsnList))
                    .info();
        }

        List<String> tkBrCdList = new ArrayList<String>();
        if (StringUtils.isNotEmpty(tkBrCdString)) {
            String[] tkBrCdStr = tkBrCdString.split(";");
            if (tkBrCdStr.length > 0) {
                for (String string : tkBrCdStr) {
                    tkBrCdList.add(string);
                }
            }
        }

        List<String> carBrCdList = new ArrayList<String>();
        if (StringUtils.isNotEmpty(carBrCdString)) {
            String[] carBrCdStr = carBrCdString.split(";");
            if (carBrCdStr.length > 0) {
                for (String string : carBrCdStr) {
                    carBrCdList.add(string);
                }
            }
        }

        List<String> busBrCdList = new ArrayList<String>();
        if (StringUtils.isNotEmpty(busBrCdString)) {
            String[] busBrCdStr = busBrCdString.split(";");
            if (busBrCdStr.length > 0) {
                for (String string : busBrCdStr) {
                    busBrCdList.add(string);
                }
            }
        }

        MfrInfoVO mfrInfoVO = new MfrInfoVO();

        mfrInfoVO.setMfrName(this.checkMfrNm(mfrNm));
        mfrInfoVO.setSucc(succ);
        if (StringUtils.isNotEmpty(mfrAddrese)) {
            mfrInfoVO.setMfrAddr(mfrAddrese);
        }
        if (StringUtils.isNotEmpty(rgnPrCd)) {
            mfrInfoVO.setRgnPrCd(rgnPrCd);
        }
        if (StringUtils.isNotEmpty(rgnCyCd)) {
            mfrInfoVO.setRgnCyCd(rgnCyCd);
        }
        if (StringUtils.isNotEmpty(mfrTel)) {
            mfrInfoVO.setMfrTel(mfrTel);
        }
        mfrInfoVO.setPayTypCd(payTypCd);
        mfrInfoVO.setPayTypCdNm(payTypCdNm);
        if (CollectionUtils.isNotEmpty(tkBrCdList)) {
            mfrInfoVO.setTkBrCdList(tkBrCdList);
        }
        if (CollectionUtils.isNotEmpty(carBrCdList)) {
            mfrInfoVO.setCarBrCdList(carBrCdList);
        }
        if (CollectionUtils.isNotEmpty(busBrCdList)) {
            mfrInfoVO.setBusBrCdList(busBrCdList);
        }
        if (CollectionUtils.isNotEmpty(mfrRlPsnList)) {
            mfrInfoVO.setMfrRlPsnList(mfrRlPsnList);
        }
        return mfrInfoVO;
    }

    /**
     * 获取厂商请求参数(新增)
     *
     * @param request 请求
     * @return
     */
    private MfrInfoVO getRequestParamForPrdMfrAdd(HttpServletRequest request) throws BaseException {
        MfrInfoVO prdMfrInfoVO = this.getRequestParamForPrdMfr(request);
        prdMfrInfoVO.setMfrSource(SplSystemConstant.FL_WEB_CHL_CD);
        prdMfrInfoVO.setCrtTm(new Date());
        prdMfrInfoVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
        return prdMfrInfoVO;
    }

    /**
     * 获取厂商请求参数(修改)
     *
     * @param request 请求
     * @return
     */
    private MfrInfoVO getRequestParamForPrdMfrModify(HttpServletRequest request) throws BaseException {

        MfrInfoVO prdMfrInfoVO = this.getRequestParamForPrdMfr(request);
        prdMfrInfoVO.setMdfTm(new Date());
        prdMfrInfoVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
        return prdMfrInfoVO;
    }

    /**
     * 特殊字符(除中英文括号外)和空格校验
     *
     * @param mfrNm 厂商名称
     * @return String
     */
    private String checkMfrNm(String mfrNm) throws BaseException {
        String base = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM()（）";
        int len = mfrNm.length();
        StringBuilder sb = new StringBuilder(len);
        for (int i = 0; i < len; i++) {
            char c = mfrNm.charAt(i);
            if (base.contains(c + "") || StringUtils.isNumeric(c + "") || StringUtils.isChinese(c)) {
                sb.append(c);
            }
        }
        return sb.toString();
    }

    /**
     * 到厂商流程跟踪页面
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/toMfrFlowPage.do", method = {RequestMethod.GET})
    public ModelAndView toMfrFlowPage(HttpServletRequest request, HttpServletResponse response) {
        String mfrId = request.getParameter("mfrId");
        ModelAndView view = new ModelAndView("mfr/mfrInfo/mfrFlowList");
        view.addObject("mfrId", mfrId);
        BaseLogUtils.newWebLogger("跳转到项目流程跟踪页面").setLogOperType(LogOperEnum.REQ)
                .setSysCd(CurrentThreadContext.getCurrentSysCd())
                .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                .setWarning(false)
                .info();
        return view;
    }

    /**
     * 初始化项目流程跟踪列表
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/initPorjectFlowList.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object initPorjectFlowList(HttpServletRequest request, HttpServletResponse response) {
        String mfrId = request.getParameter("mfrId");//厂商Id
        List<MfrFlowSHVO> list = new ArrayList<MfrFlowSHVO>();
        if (StringUtils.isNotEmpty(mfrId)) {
            list = this.mfrInfoService.searchMfrFlowList(Long.valueOf(mfrId));
            for (MfrFlowSHVO projectFlowSHVO : list) {
                if (StringUtils.isEmpty(projectFlowSHVO.getGrpFlag())) {
                    projectFlowSHVO.setGrpFlag("-");
                }
            }
            Collections.sort(list, new Comparator<MfrFlowSHVO>() {
                public int compare(MfrFlowSHVO o1, MfrFlowSHVO o2) {
                    if (o1.getGrpFlag().compareTo(o2.getGrpFlag()) != 0) {
                        return o1.getGrpFlag().compareTo(o2.getGrpFlag());
                    }
                    return o1.getBusTyp().compareTo(o2.getBusTyp());
                }
            });
        }
        ListPageVO<MfrFlowSHVO> listPage = new ListPageVO<MfrFlowSHVO>(list, list.size());
        return listPage;
    }

    /**
     * 跳转厂商资料新增页面
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/toMfrFileAddPage.do", method = {RequestMethod.GET})
    public ModelAndView toMfrFileAddPage(HttpServletRequest request, HttpServletResponse response) {
        String mfrId = request.getParameter("mfrId");
        String isApply = request.getParameter("isApply");
        String isFlow = request.getParameter("isFlow"); //流程标识 1：是，0或者空：否
        String isCheckVerify = request.getParameter("isCheckVerify");//信审审核附件标识 1：是，0或者空：否
        String isDetail = request.getParameter("isDetail");//是否详细页面，流程中标识，1：是，0或者空：否
        String isMdfPayTyp = request.getParameter("isMdfPayTyp") ;//流程中是否可修改放款状态 1：是，0或者空：否
        String isModify = request.getParameter("isModify");//流程中是否可修改基本信息标识 1：是，0或者空：否

        ModelAndView view = new ModelAndView("mfr/mfrInfo/mfrFileAdd");
        view.addObject("mfrId", mfrId);
        view.addObject("isDetail", isDetail);
        view.addObject("isApply", isApply);
        view.addObject("isCheckVerify", isCheckVerify);
        view.addObject("isFlow", isFlow);
        view.addObject("isMdfPayTyp", isMdfPayTyp);
        view.addObject("isModify", isModify);

        //查询附件信息
        String cfgCd = null;
        String tabNm = null;
        String cfgOrgCd = null;
        String cfgSysCd = null;
        String modulePath = null;
        String rootPath = null;
        String costomerPath = null;
        String uploadSysCd = null;
        //自然人 附件查询
        cfgCd = SplInfoFileCfgEnum.MFR022.getCode();
        tabNm = SplInfoFileCfgEnum.MFR022.getTableNm();
        cfgOrgCd = SplInfoFileCfgEnum.MFR022.getOrgCd();
        cfgSysCd = SplInfoFileCfgEnum.MFR022.getSysCd();
        modulePath = SplInfoFileCfgEnum.MFR022.getModulePath();
        costomerPath = SplInfoFileCfgEnum.MFR022.getUploadCostomerPath();
        rootPath = SplInfoFileCfgEnum.MFR022.getUploadRootPath();
        uploadSysCd = SplInfoFileCfgEnum.MFR022.getUploadSysCd();

        view.addObject("tabNm", tabNm);
        view.addObject("cfgCd", cfgCd);
        view.addObject("cfgOrgCd", cfgOrgCd);
        view.addObject("cfgSysCd", cfgSysCd);
        view.addObject("modulePath", modulePath);
        view.addObject("costomerPath", costomerPath);
        view.addObject("rootPath", rootPath);
        view.addObject("uploadSysCd", uploadSysCd);

        String serverPath = PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_SERVER_PATH);// 服务地址
        String customerPah = PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_COSTOMER_PATH);
        String headPic = PropertiesCacheUtils.getProperty(fl.constant.facade.framework.constant.UploadConstant.DEFAULT_NO_PIC);
        view.addObject("defImg", serverPath + customerPah + headPic);
        BaseLogUtils.newWebLogger("跳转到供应商资料新增页面").setLogOperType(LogOperEnum.REQ)
                .setSysCd(CurrentThreadContext.getCurrentSysCd())
                .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                .setWarning(false)
                .info();
        return view;
    }

    /**
     * 初始化资料列表
     */
    @RequestMapping(value = "/initMfrFileInfoList.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object initMfrFileInfoList(HttpServletRequest request, HttpServletResponse response) {
        String mfrId = request.getParameter("mfrId");
        String cfgCd = request.getParameter("cfgCd");//附件配置编号
        String tabNm = request.getParameter("tabNm");//附件对应表名
        String cfgOrgCd = request.getParameter("cfgOrgCd");
        String cfgSysCd = request.getParameter("cfgSysCd");
        SysUlFilesRecQueryCondition qc = new SysUlFilesRecQueryCondition();
        qc.setPkId(mfrId);
        qc.setCfgCd(cfgCd);
        if (StringUtils.isNotEmpty(cfgSysCd)) {
            qc.setSysCd(cfgSysCd);
        } else {
            qc.setSysCd(SplSystemConstant.SPL_SYS_CD);
        }
        if (StringUtils.isNotEmpty(cfgOrgCd)) {
            qc.setOrgCd(cfgOrgCd);
        } else {
            qc.setOrgCd(SplSystemConstant.DEFAULT_ORG_CD);
        }
        if (StringUtils.isNotEmpty(tabNm)) {
            qc.setTabNm(tabNm);
        }
        qc.setIsDel(BaseConstant.IS_YESNO_NO);
        List<PrjFileInfoVO> list = this.getUploadFileList(qc);
        ListPageVO<PrjFileInfoVO> listPageVO = null;
        if (CollectionUtils.isNotEmpty(list)) {
            listPageVO = new ListPageVO<PrjFileInfoVO>(list, list.size());
        } else {
            listPageVO = new ListPageVO<PrjFileInfoVO>(new ArrayList<PrjFileInfoVO>(), 0);
        }
        BaseLogUtils.newWebLogger("数据").setLogOperType(LogOperEnum.RESP)
                .setSysCd(CurrentThreadContext.getCurrentSysCd())
                .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                .setWarning(false)
                .setKeys("listPageVO", JSON.toJSONString(listPageVO))
                .info();
        return listPageVO;
    }

    private List<PrjFileInfoVO> getUploadFileList(SysUlFilesRecQueryCondition condition) throws BaseException {
        //查询资料配置，系统代码,组织架构代码,配置编号 ,业务主键
        SysUlDatCfgQueryCondition ulDatCfgQueryCondition = new SysUlDatCfgQueryCondition();
        ulDatCfgQueryCondition.setSysCd(condition.getSysCd());//系统代码
        ulDatCfgQueryCondition.setOrgCd(condition.getOrgCd());
        ulDatCfgQueryCondition.setDataId(String.valueOf(condition.getPkId()));//业务主键
        ulDatCfgQueryCondition.setIsValid(BaseConstant.IS_YESNO_YES);
        List<String> cfgCdList = new ArrayList<>();
        cfgCdList.add(condition.getCfgCd());//配置编号
        ulDatCfgQueryCondition.setCfgCdList(cfgCdList);//配置编号集合
        List<SysUlDatCfgDTO> list = this.uploadApiService.searchSysUlDatCfgListByDataId(ulDatCfgQueryCondition);

        List<PrjFileInfoVO> voList = null;
        if (CollectionUtils.isNotEmpty(list)) {
            Map<String, String> audStsCdMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), CapitalConstant.CODE_MATE_AUD_STS_CD);
            voList = new ArrayList<>();
            PrjFileInfoVO vo;
            //设置路径
            String picServicePath = PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_SERVER_PATH);
            for (SysUlDatCfgDTO dto : list) {
                for (SysUlDatCfgDtlDTO dtlDTO : dto.getSysUlDatCfgDtlDTOList()) {
                    vo = new PrjFileInfoVO();
                    vo.setId(Long.valueOf(condition.getPkId()));//业务主键
                    vo.setCfgDtlCd(dtlDTO.getCfgDtlCd());//配置子编号
                    vo.setDatNm(dtlDTO.getDatNm());//配置名称
                    vo.setCfgCd(dtlDTO.getCfgCd());//配置编号
                    vo.setOrgCd(dtlDTO.getOrgCd());//配置组织架构代码
                    vo.setCfgNm(dto.getCfgNm());//配置子名称
                    vo.setFileId(dtlDTO.getRecId());//附件ID
                    //如果有HTTP开头说明是可以访问路径,无需干涉
                    if (StringUtils.isNotBlank(dtlDTO.getFilePath()) && !dtlDTO.getFilePath().startsWith("http") && StringUtils.isNotBlank(picServicePath)) {
                        vo.setFilePath(picServicePath + dtlDTO.getFilePath());
                    } else {
                        vo.setFilePath(dtlDTO.getFilePath());
                    }
                    vo.setFileNm(dtlDTO.getRecFileNm());//上传名称
                    vo.setCrtTm(dtlDTO.getRecCrtTm());//上传时间
                    vo.setIsMust(dtlDTO.getIsMust());//是否必传
                    if (StringUtils.isNotBlank(dtlDTO.getRecAudStsCd())) {
                        vo.setAudStsCd(dtlDTO.getRecAudStsCd());//验证状态
                    } else {
                        vo.setAudStsCd("0");//验证状态
                    }

                    if (audStsCdMap != null && audStsCdMap.containsKey(vo.getAudStsCd())) {
                        vo.setAudStsCdNm(audStsCdMap.get(vo.getAudStsCd()));
                    }
                    voList.add(vo);
                }
            }
        }
        return voList;
    }

    /**
     * 资料新增
     *
     * @param request
     * @param response
     * @return
     * @throws BaseException
     */
    @RequestMapping(value = "/addMfrFileList.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object addMfrFileList(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
        List<SysUlFilesRecVO> fileList = new ArrayList<SysUlFilesRecVO>();
        try {
            fileList = this.getFileList(request);
            if (CollectionUtils.isEmpty(fileList)) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo("没有要保存的资料.");
                BaseLogUtils.newWebLogger("新增供应商资料失败,没有要保存的资料").setLogOperType(LogOperEnum.RESP)
                        .setSysCd(CurrentThreadContext.getCurrentSysCd())
                        .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                        .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                        .setWarning(false)
                        .warn(LogExceptionEnum.COMMON_CODE_0002);
                return result;
            }
            String fileId = request.getParameter("fileId");
            if (StringUtils.isNotEmpty(fileId)) {
                //先删除
                //this.uploadApiService.updateSysUlFilesRecByQC(null);
            }
            boolean success = this.mfrInfoService.batchAddFileList(fileList);
            if (!success) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(SysLogConstant.LOG_CMM_ADD_FAIL);
                BaseLogUtils.newWebLogger("新增厂商资料失败").setLogOperType(LogOperEnum.RESP)
                        .setSysCd(CurrentThreadContext.getCurrentSysCd())
                        .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                        .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                        .setWarning(false)
                        .warn(LogExceptionEnum.COMMON_CODE_0002);
                return result;
            } else {
                result.setSuccess(BaseConstant.IS_YESNO_YES);
                result.setInfo(SysLogConstant.LOG_CMM_ADD_SUCC);
                BaseLogUtils.newWebLogger("新增厂商资料成功").setLogOperType(LogOperEnum.RESP)
                        .setSysCd(CurrentThreadContext.getCurrentSysCd())
                        .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                        .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                        .setWarning(false)
                        .setKeys("result", JSON.toJSONString(result))
                        .info();
                return result;
            }
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.newWebLogger("新增厂商资料失败，业务异常").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .setThrowable(ex)
                    .warn(LogExceptionEnum.COMMON_CODE_0002);
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.newWebLogger("新增厂商资料失败，系统异常").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .setThrowable(ex)
                    .error(LogExceptionEnum.COMMON_CODE_0099);
        }

        return result;
    }

    /**
     * 获取资料信息
     *
     * @param request
     * @return
     * @throws BaseException
     */
    private List<SysUlFilesRecVO> getFileList(HttpServletRequest request) throws BaseException {
        String mfrId = request.getParameter("mfrId");
        if (StringUtils.isEmpty(mfrId)) {
            throw new BaseException(BaseExceptionConstant.COMMON_0001, "厂商ID不能为空!");
        }
        String fileParams = request.getParameter("fileParams");//附件上传信息
        String cfgCd = request.getParameter("cfgCd");
        String cfgDtlCd = request.getParameter("cfgDtlCd");
        String orgCd = request.getParameter("orgCd");
        String cfgSysCd = request.getParameter("cfgSysCd");
        String rootPath = request.getParameter("rootPath");
        String tabNm = request.getParameter("tabNm");
        List<SysUlFilesRecVO> sysUlFilesRecVOList = new ArrayList<SysUlFilesRecVO>();
        //解析附件上传信息
        if (StringUtils.isNotEmpty(fileParams)) {
            List<Map<String, String>> fileParamsList = new ArrayList<Map<String, String>>();
            JSONArray arry = JSONArray.fromObject(fileParams);
            if (!(arry.size() > 0)) {
                throw new BaseException(BaseExceptionConstant.COMMON_0001, "没有要保存的资料信息");
            }
            for (int i = 0; i < arry.size(); i++) {
                net.sf.json.JSONObject jsonObject = arry.getJSONObject(i);
                Iterator<?> it = jsonObject.keys();
                HashMap<String, String> hMap = new HashMap<String, String>();
                while (it.hasNext()) {
                    String key = String.valueOf(it.next());
                    String value = (String) jsonObject.get(key);
                    hMap.put(key, value);
                }
                fileParamsList.add(hMap);
            }
            for (Map<String, String> map : fileParamsList) {
                SysUlFilesRecVO sysUlFilesRecVO = new SysUlFilesRecVO();
                sysUlFilesRecVO.setFileNm(map.get("fileNm"));
                sysUlFilesRecVO.setFilePath(map.get("filePath"));
                if (StringUtils.isNotEmpty(rootPath)) {
                    sysUlFilesRecVO.setAbsLocPath(PropertiesCacheUtils.getProperty(rootPath) + map.get("filePath"));
                } else {
                    sysUlFilesRecVO.setAbsLocPath(PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_ROOT_PATH) + map.get("filePath"));
                }
                sysUlFilesRecVO.setCrtTm(new Date());
                sysUlFilesRecVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
                sysUlFilesRecVO.setPkId(mfrId);
                if (StringUtils.isNotEmpty(cfgSysCd)) {
                    sysUlFilesRecVO.setSysCd(cfgSysCd);
                } else {
                    sysUlFilesRecVO.setSysCd(CurrentThreadContext.getCurrentSysCd());
                }
                if (StringUtils.isNotEmpty(orgCd)) {
                    sysUlFilesRecVO.setOrgCd(orgCd);
                } else {
                    sysUlFilesRecVO.setOrgCd(SplSystemConstant.DEFAULT_ORG_CD);
                }
                if (StringUtils.isNotEmpty(cfgCd)) {
                    sysUlFilesRecVO.setCfgCd(cfgCd);
                } else {
                    sysUlFilesRecVO.setCfgCd(SplInfoFileCfgEnum.MFR022.getCode());
                }
                if (StringUtils.isNotEmpty(cfgDtlCd)) {
                    sysUlFilesRecVO.setCfgDtlCd(cfgDtlCd);
                }
                //默认验证状态:未验证
                sysUlFilesRecVO.setAudStsCd(PropertiesCacheUtils.getProperty(fl.constant.facade.framework.constant.DictionaryConstant.CODE_GRP_VALID_STATUS_CD_A));
                if (StringUtils.isNotEmpty(tabNm)) {
                    sysUlFilesRecVO.setTabNm(tabNm);
                } else {
                    sysUlFilesRecVO.setTabNm(SplInfoFileCfgEnum.MFR022.getTableNm());
                }
                sysUlFilesRecVO.setIsDel(BaseConstant.IS_YESNO_NO);
                sysUlFilesRecVOList.add(sysUlFilesRecVO);
            }
        } else {
            throw new BaseException(BaseExceptionConstant.COMMON_0001, "保存供应商资料信息,没有要保存的资料.");
        }
        return sysUlFilesRecVOList;
    }

    /**
     * 修改项目资料的验证状态
     *
     * @param request
     * @param response
     * @return
     * @throws BaseException
     */
    @RequestMapping(value = "/modifyFileAudStsCd.do", method = {RequestMethod.POST})
    @ResponseBody
    public DataResultVO modifyFileAudStsCd(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
        String fileId = request.getParameter("fileId");
        String audStsCd = request.getParameter("audStsCd");
        if (StringUtils.isEmpty(fileId)) {
            BaseLogUtils.newWebLogger("修改资料的验证状态,资料ID为空").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .warn(LogExceptionEnum.COMMON_CODE_0002);
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("验证操作失败");
            return result;
        }
        if (StringUtils.isBlank(audStsCd)) {
            BaseLogUtils.newWebLogger("修改资料的验证状态,验证状态为空").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .warn(LogExceptionEnum.COMMON_CODE_0002);
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("验证操作失败");
            return result;
        }
        boolean success = this.uploadApiService.modifySysUlFilesRecAudStsCdById(Long.valueOf(fileId), audStsCd);
        BaseLogUtils.newWebLogger("修改资料的验证状态").setLogOperType(LogOperEnum.RESP)
                .setSysCd(CurrentThreadContext.getCurrentSysCd())
                .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                .setWarning(false)
                .setKeys("result", JSON.toJSONString(result))
                .info();
        if (!success) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("验证操作失败");
        }
        return result;
    }

    /**
     * 删除项目资料
     *
     * @param request
     * @param response
     * @return
     * @throws BaseException
     */
    @RequestMapping(value = "/removeFile.do", method = {RequestMethod.POST})
    @ResponseBody
    public DataResultVO removeFile(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
        String fileId = request.getParameter("fileId");
        if (StringUtils.isEmpty(fileId)) {
            BaseLogUtils.newWebLogger("删除附件信息,附件ID为空").setLogOperType(LogOperEnum.REQ)
                    .setSysCd(CurrentThreadContext.getCurrentSysCd())
                    .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                    .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                    .setWarning(false)
                    .warn(LogExceptionEnum.COMMON_CODE_0002);
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_DELETE_FAIL);
            return result;
        }
        List<Long> idList = new ArrayList<>(1);
        idList.add(Long.valueOf(fileId));
        boolean success = sysUlFilesRecService.removeByIds(idList);
        BaseLogUtils.newWebLogger("删除附件信息").setLogOperType(LogOperEnum.RESP)
                .setSysCd(CurrentThreadContext.getCurrentSysCd())
                .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                .setWarning(false)
                .setKeys("result", JSON.toJSONString(result))
                .info();
        if (!success) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_DELETE_FAIL);
        }
        return result;
    }


    /**
     * 三要素校验 厂商联系人
     * @param request
     * @param response
     * @return
     * @throws BaseException
     */
    @RequestMapping(value = "/checkRlPsn.do", method = { RequestMethod.POST })
    @ResponseBody
    public Object checkRlPsnMessage(HttpServletRequest request, HttpServletResponse response) throws BaseException {

        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,SysLogConstant.LOG_CMM_UPDATE_SUCC);
        String type = request.getParameter("type");//校验类型
        String rlPsnId = request.getParameter("rlPsnId");//联系人ID
        String rlNm = request.getParameter("rlNm");//联系人姓名
        String certNo = request.getParameter("certNo");//联系人身份证号
        String tel = request.getParameter("tel");//联系人电话
        String busId = request.getParameter("mfrId");//所属主键ID
        String rlTypCd = request.getParameter("rlTypCd");//联系人类型
        String applyPsnId = request.getParameter("applyPsnId");//变更人ID
        String modId = request.getParameter("modId");// 供应商属性(1:自然人,2:法人)
        if(StringUtils.isEmpty(type)){
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("参数不完整");
            return result ;
        }
        if(StringUtils.isEmpty(certNo)){
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("联系人身份证号不能为空");
            return result ;
        }
        if(StringUtils.isEmpty(rlNm)){
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("联系姓名不能为空");
            return result ;
        }
        if("verify".equals(type)){
            if(StringUtils.isEmpty(busId)){
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo("供应商ID不能为空");
                return result ;
            }
        }else{
            if(StringUtils.isEmpty(tel)){
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo("手机号不能为空");
                return result ;
            }
        }
        if(StringUtils.isEmpty(rlPsnId) && StringUtils.isEmpty(applyPsnId)){
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("主键ID不能为空");
            return result ;
        }
        HashMap<String, String> dataMap = new HashMap<>();
        dataMap.put("type", type);
        dataMap.put("rlId", rlPsnId);
        dataMap.put("rlNm", rlNm);
        dataMap.put("tel", tel);
        dataMap.put("busId", busId);
        dataMap.put("certNo", certNo);
        dataMap.put("rlTypCd", rlTypCd);
        if(StringUtils.isEmpty(applyPsnId) || applyPsnId == "null" ){
            dataMap.put("applyPsnId", "");
        }else{
            dataMap.put("applyPsnId", applyPsnId);
        }
        if(StringUtils.isEmpty(modId)){
            dataMap.put("modId", "");
        }else{
            dataMap.put("modId", modId);
        }
        fl.riskctrl.facade.riskctrl.dto.DataResultDTO checkRlPsn = this.mfrRlPsnService.checkRlPsn(dataMap);
        BaseLogUtils.newWebLogger("查询结果").setLogOperType(LogOperEnum.RESP)
                .setSysCd(CurrentThreadContext.getCurrentSysCd())
                .setChannelCd(SplSystemConstant.FL_WEB_CHL_CD)
                .setBussinessId(BusinessIdConstant.LOG_PROD_MANAGER_CD)
                .setWarning(false)
                .setKeys("checkRlPsn", JSON.toJSONString(checkRlPsn))
                .info();
        result.setSuccess(checkRlPsn.getSuccess());
        result.setInfo(checkRlPsn.getInfo());
        result.setData(checkRlPsn.getData());
        return result ;
    }

}
